<template>
  <div class="menu_header">
    <div style="display: flex">
      <img class="logo" src="../../assets/logo.png" alt="logo" />
      <el-menu
        :default-active="activeIndex"
        class="el-menu-demo"
        mode="horizontal"
        @select="handleSelect"
        background-color="#121212"
        text-color="#fff"
        active-text-color="#ffd04b"
      >
        <!-- background-color="#121212"
      text-color="#fff" -->
        <el-sub-menu index="1">
          <template #title>买币</template>
          <el-menu-item index="2-1">
            <div class="sub_item">
              <img src="../..//assets/img/meun/bull.png" alt="" />
              <div>
                <h3>快捷买币</h3>
                <p>流程简单,快速成交</p>
              </div>
            </div>
          </el-menu-item>
          <el-menu-item index="2-2">
            <div class="sub_item">
              <img src="../..//assets/img/meun/refill.png" alt="" />
              <div>
                <h3>链上充值</h3>
                <p>灵活选择,快速到账</p>
              </div>
            </div>
          </el-menu-item>
        </el-sub-menu>
        <el-menu-item index="2"> 市场 </el-menu-item>
        <el-sub-menu index="3">
          <!-- hide-timeout="100000" -->
          <template #title>交易</template>
          <el-menu-item index="3-1">
            <div class="sub_item sub_item_center">
              <img src="../..//assets/img/meun/refill.png" alt="" />
              <h3>币币交易</h3>
            </div>
          </el-menu-item>
          <el-menu-item index="3-2">
            <div class="sub_item sub_item_center">
              <img src="../..//assets/img/meun/refill.png" alt="" />
              <h3>合约交易</h3>
            </div>
          </el-menu-item>
          <el-menu-item index="3-3">
            <div class="sub_item sub_item_center">
              <img src="../..//assets/img/meun/refill.png" alt="" />
              <h3>期权交易</h3>
            </div>
          </el-menu-item>
        </el-sub-menu>
        <el-menu-item index="4"> 金融 </el-menu-item>
      </el-menu>
    </div>
    <div class="right">
      <!-- 未登录 -->
      <div class="login">
        <p
          v-for="i in tab_login"
          :key="i"
          :class="i.active ? 'active' : ''"
          @click="tab_login_tagger(i)"
        >
          {{ i.name }}
        </p>
      </div>
      <!-- 登录过 -->

      <el-dropdown :hide-on-click="false">
        <span class="el-dropdown-link">
          资产管理 <el-icon color="#fff"><ArrowDownBold /></el-icon
        ></span>

        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item>Action 1</el-dropdown-item>
            <el-dropdown-item>Action 2</el-dropdown-item>
            <el-dropdown-item>Action 3</el-dropdown-item>
            <el-dropdown-item disabled>Action 4</el-dropdown-item>
            <el-dropdown-item divided>Action 5</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>

      <img src="../../assets/img/meun/person.png" alt="" />
      <img src="../../assets/img/meun/upload.png" alt="" />
      <img src="../../assets/img/meun/inform.png" alt="" />
      <img src="../../assets/img/meun/service.png" alt="" />
      <img src="../../assets/img/meun/network.png" alt="" />
    </div>
  </div>
</template>
<script>
import { ref } from "vue";
export default {
  name: "MeunP",
  setup() {
    const activeIndex = ref("1");
    const tab_login = ref([
      {
        name: "登录",
        id: 1,
        active: false,
      },
      {
        name: "注册",
        id: 2,
        active: false,
      },
    ]);
    const handleSelect = (key, keyPath) => {
      console.log(key, keyPath);
    };
    const tab_login_tagger = (data) => {
      tab_login.value.forEach((i) => {
        i.active = i.id == data.id ? true : false;
      });
    };
    return { activeIndex, tab_login, handleSelect, tab_login_tagger };
  },
};
</script>
<style lang="scss">
.menu_header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #121212;
  padding: 0 100px 0 123px;
  .logo {
    width: 57px;
    // height: 17px;
    margin-right: 65px;
  }
  .el-menu-demo {
    width: 500px;
    border-bottom: none !important;
    // background-color: #121212;
  }
  .right {
    display: flex;
    align-items: center;
    // height: 100%;
    img {
      // margin-top: 6px;
      width: 20px;
      height: 20px;
      margin-left: 16px;
    }
    .login {
      display: flex;
      margin-right: 17px;
      > p {
        padding: 6px 10px;
        font-size: 12px;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #ffffff;
        margin-right: 5px;
        box-sizing: border-box;
      }
      > .active {
        border: 1px solid #ffffff;
        border-radius: 12px;
      }
    }
    >.el-dropdown {
      // margin-top: 6px;
      // height: 100%;
      color: #fff;
      font-size: 12px;
      font-family: Source Han Sans CN;
      font-weight: 400;
      .el-tooltip__trigger {
        display: flex;
        align-items: center;
      }
      i {
        margin-left: 5px;
      }
    }
  }
}

.sub_item {
  display: flex;
  align-items: center;
  //   height: 140px;
  > img {
    width: 27px;
    height: 27px;
    margin-right: 16px;
  }
  h3 {
    font-size: 18px;
    font-family: Source Han Sans CN;
    font-weight: 400;
    color: #000000;
  }
  > div {
    display: flex;
    flex-direction: column;
    p {
      margin-top: 8px;
      font-size: 14px;
      font-family: Source Han Sans CN;
      font-weight: 400;
      color: #666666;
    }
  }
}
.sub_item_center {
  width: 100%;
  padding-left: 20px;
  > img {
    width: 24px;
    height: 24px;
    margin-right: 16px;
  }
}
//

.el-menu--popup-container {
  color: #fff;
  > .el-menu--popup {
    --el-menu-bg-color: #fff !important;
    --el-menu-text-color: #000 !important;
    --el-menu-hover-bg-color: #ccc !important;
    --el-menu-active-color: #ccc !important;
    --el-menu-horizontal-sub-item-height: auto;
    > li {
      height: 65px !important;
    }
  }
}
</style>